
package com.joysuch.wwyt.edu.enums;

public enum QualifiedTypes {

    //培训结果
    QUALIFIED("Y", "合格"), UN_QUALIFIED("N", "不合格"),
    //培训效果
    EXCELLENCE("1","优秀"),GOOD("2","良好"),TRACEABLITY("3","一般"), NONCONFORMITY("4", "较差");

    private String code;
    private String name;

    private QualifiedTypes(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static QualifiedTypes findByName(String name) {
        QualifiedTypes[] values = QualifiedTypes.values();
        for (QualifiedTypes v : values) {
            if (v.getName().equals(name)) {
                return v;
            }
        }
        return null;
    }

    public static QualifiedTypes findByCode(String code) {
        QualifiedTypes[] values = QualifiedTypes.values();
        for (QualifiedTypes v : values) {
            if (v.getCode().equals(code)) {
                return v;
            }
        }
        return null;
    }

    public static String findNameByCode(String code) {
        QualifiedTypes types = findByCode(code);
        return types == null ? null : types.name;
    }
}
